package com.wing.order.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 领货单
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_order_receive")
public class OrderReceive extends BaseEntity<OrderReceive> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 已创建
        */
        created(0,"已领货"),
        /**
        * 上货中
        */
        loading(1,"上货中"),
        /**
        * 上货完成
        */
        finish(2,"上货完成");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Type implements IEnum<Integer> {

        /**
         * 补货上货
         */
        replenishment(0,"补货上货"),
        /**
         * 自主上货
         */
        selfLoad(1,"自主上货");

        private int code;
        private String desc;

        Type(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }


    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 配货订单编号
     */
    private String code;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 配货需求单id
     */
    private Long demandId;

    private Integer no;

    private Integer day;

    private String taskCode;

    private String loadCode;


    /**
     * 类型
     */
    private Type type;

    /**
     * 类型描述
     */
    @TableField(exist = false)
    private String typeDesc;

    public String getTypeDesc() {
        return type == null ? null : type.getDesc();
    }


    /**
     * 上货计划id
     */
    private Long loadPlanId;

}
